var n = getApp(),
    t = n.requirejs("core");

n.requirejs("jquery"), n.requirejs("foxui");

Page({
    onPullDownRefresh: function () {
        var n = this;
        t.get("groups", {}, function (t) {
            0 == t.error && (n.setData({
                res: t
            }), wx.stopPullDownRefresh());
        });
    },
    data: {
        category: [],
        currentTab: 0,
        list: []
    },
    onLoad: function (e) {
        n.checkAuth();
        var a = this;
        n.getCache("isIpx") ? a.setData({
            isIpx: !0,
            iphonexnavbar: "fui-iphonex-navbar"
        }) : a.setData({
            isIpx: !1,
            iphonexnavbar: ""
        }), t.get("groups.list", {
            category:1,
            zczlstatus: 1,
        }, function (n) {
            console.log(n,1111);
            a.setData({
                list:n.list
            });
        });
        //请求tabr
        t.get("groups", {
        }, function (n) {
            a.setData({
                category: n.category,
            });
        });
    },
    tabchange(e) {
        var that = this
        that.setData({
            currentTab: e.currentTarget.dataset.current,
            id:e.currentTarget.dataset.id
        })
        t.get("groups.list", {
            category: e.currentTarget.dataset.id == e.currentTarget.dataset.current ? e.currentTarget.dataset.current : Number(e.currentTarget.dataset.current) + 1,
            zczlstatus: 1 //为1 为助力商品
        }, ((e) => {
            that.setData({
                list: e.list
            })
        }))
    },
    advheight: function (n) {
        var t = n.detail.width / n.detail.height;
        this.setData({
            advheight: 750 / t
        });
    },
    navigate: function (n) {
        var e = t.pdata(n).link;
        wx.navigateTo({
            url: e,
            fail: function () {
                wx.switchTab({
                    url: e
                });
            }
        });
    },
    onReady: function () {},
    onShow: function () {},
    onHide: function () {},
    onUnload: function () {},
    onReachBottom: function () {
        this.onPullDownRefresh();
    },
    onShareAppMessage: function () {
        return t.onShareAppMessage();
    }
});